﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TestSysRedNofity : MonoBehaviour
{

    // Use this for initialization
    void Start()
    {

    }

    private void OnGUI()
    {
        if (GUILayout.Button("添加小红点"))
        {
            //PLDebug.BeginSample("红点");

            PLDebug.BeginTimer("发送红点通知");
            for (int i = 0; i < 100; i++)
            {
                SysMsgMgr.I.Notify(ESysRedType.BagLv1, new SysMsg()
                {
                    mType = ESysRedType.BagForgeLv3,
                    guid = i.ToString()
                });
            }
            for (int i = 0; i < 100; i++)
            {
                SysMsgMgr.I.Notify(ESysRedType.BagLv1, new SysMsg()
                {
                    mType = ESysRedType.BagStarLv3,
                    guid = i.ToString()
                });
            }
            PLDebug.EndTimer();


        }

        if (GUILayout.Button("删除小红点BagLv1"))
        {
            PLDebug.BeginTimer("删除红点通知");
            SysMsgMgr.I.RemoveMsg(ESysRedType.BagLv1);
            PLDebug.EndTimer();

        }
        if (GUILayout.Button("删除小红点BagStarLv2"))
        {
            PLDebug.BeginTimer("删除红点通知");
            SysMsgMgr.I.RemoveMsg(ESysRedType.BagStarLv2);
            PLDebug.EndTimer();
        }
        if (GUILayout.Button("删除小红点BagForgeLv2"))
        {
            PLDebug.BeginTimer("删除红点通知");
            SysMsgMgr.I.RemoveMsg(ESysRedType.BagForgeLv2);
            PLDebug.EndTimer();
        }
        if (GUILayout.Button("打印树信息"))
        {
            Dictionary<ESysRedType, TreeStruct<SysMsgNode>> d = (Dictionary<ESysRedType, TreeStruct<SysMsgNode>>)SysMsgMgr.I.RefGetFieldVal("mDicMsgTemp");

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            foreach (var item in d.Values)
            {
                sb.AppendLine(item.Value.mType + " " + item.Value.MsgCount());
            }
            PLDebug.Log(sb.ToString());
        }


    }

    // Update is called once per frame
    void Update()
    {

    }
}
